Current Location: Home> Function Categories> chdir

chdir

Change directory
Name:chdir
Category:Directory functions
Programming Language:php
One-line Description:Change the current directory.

Definition and usage

chdir() function changes the current directory.

Example

Change the current directory:

 <?php
// Get the current directory
echo getcwd ( ) . "<br>" ;

// Change directory
chdir ( "images" ) ;

// Obtain the current directory
echo getcwd ( ) ;
?>

result:

 /home/php
/home/php/images

grammar

 chdir ( directory ) ;
parameter describe
Directory Required. Specify the new current directory.
Similar Functions
Popular Articles